/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    usart.h
  * @brief   This file contains all the function prototypes for
  *          the usart.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2022 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__
#define __USART_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */
#include <stdio.h>
/* USER CODE END Includes */

extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;

/* USER CODE BEGIN Private defines */
//若要开启DMA接收，则更改宏定义为0 如果要开启中断接收 则更改下面的MODE宏定义为1 
	
#define RECEIVE_MODE  0    	
	
#define RXBUFFERSIZE  255     //it最大接收字节数	
#define USER_UART1    1		//UART1
#define USER_UART2    2		//UART2
/* USER CODE END Private defines */
extern uint8_t itRxBuff[RXBUFFERSIZE];   //IT接收数据存放处
extern uint8_t *dmaRxBuff1;
extern uint8_t *dmaRxBuff1;
extern uint8_t total_length;
extern uint8_t Uart1_Rx_Cnt;		//接收缓冲计数
void MX_USART1_UART_Init(void);
void MX_USART2_UART_Init(void);
void bspUartInit(uint8_t uart_id);
void uartReceiveStart(uint8_t uart_id, uint8_t *recv_data, uint16_t size);
void write_uart(uint8_t uart_id, uint8_t *send_data, uint16_t size);
/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __USART_H__ */

